package com.afdor.rws.event.driven.config;

import com.afdor.rws.annotation.extension.Extension;
import com.afdor.rws.annotation.extension.SPI;
import com.afdor.rws.event.driven.commons.Constants;
import lombok.Data;
import lombok.NonNull;

import java.io.Serializable;

/**
 * 事件总线相关配置<br/>
 * Extension : prototype
 *
 * @author 悭梵
 * @date Created in 2018-11-21 15:45
 */
@Data
@SPI(Constants.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME)
@Extension(value = Constants.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME, scope = Extension.Scope.PROTOTYPE, interfaceClass = EventBusConfig.class)
public class EventBusConfig extends BaseEventConfig implements Serializable, Cloneable {

    /**
     * 事件总线中事物ID 生成策略，扩展点名称。默认uuid，由IdGeneratorStrategy.SPI("uuid")负责激活默认值
     */
    private String transactionIdStrategyName;
    /**
     * 聚合根事件是否发送，默认不发送
     */
    private boolean sendAggregationEvent = false;

    public EventBusConfig() {
    }

    public EventBusConfig(@NonNull final EventConfig eventConfig) {
        setEventConfig(eventConfig);
    }
}
